import 'package:flutter/material.dart';

void main() {
  runApp(new MaterialApp(
    debugShowCheckedModeBanner: false,
    home: HomeScreen(),
  ));
}

class HomeScreen extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return new HomeScreenState();
  }
}

class HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateMixin {

  TabController _tabController;

  @override
  void initState() {
    super.initState();
    _tabController = TabController(length: 2, vsync: this);
    _tabController.addListener((){
        switch(_tabController.index){
          case 0:

            break;
          case 1:

            break;
        }
    });
  }

  @override
  void dispose() {
    super.dispose();
    _tabController.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        leading: IconButton(icon: Icon(Icons.arrow_back), onPressed: () {}),
        automaticallyImplyLeading: true,
        title: Text("Hello worldHello worldHello worldHello worldHello worldHello worldHello world"),
        actions: <Widget>[
          IconButton(
            icon: Icon(Icons.menu),
            onPressed: (){},
          )
        ],
        flexibleSpace: Text("flex"),
        bottom: TabBar(
          tabs: <Widget>[
            Tab(icon: Icon(Icons.home,color: Colors.red,),text: "adf",),
            Tab(icon: Icon(Icons.message))
          ],
          controller: _tabController,
        ),
        elevation: 4,
        shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(30))),
        //backgroundColor: Colors.blueGrey,
        brightness: Brightness.light,//状态栏
        centerTitle: true,
        titleSpacing: 10,
        //toolbarOpacity: 0.5,bottomOpacity: 0.2,
      ),

      body: Container(),

      floatingActionButton: FloatingActionButton(onPressed: (){},child: Icon(Icons.add),),
      floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,

      drawer: Drawer(

      ),

      persistentFooterButtons: <Widget>[
        RaisedButton(child: Text("PersistentFooter"),onPressed: (){},)
      ],

      endDrawer: Drawer(),

      bottomNavigationBar: BottomNavigationBar(items: <BottomNavigationBarItem>[
        BottomNavigationBarItem(icon: Icon(Icons.home),title: Text("Home")),
        BottomNavigationBarItem(icon: Icon(Icons.message),title: Text("Message")),
      ]),

      bottomSheet: Text("bottomSheet"),

      backgroundColor: Colors.pink,


      resizeToAvoidBottomPadding: false,
    );
  }
}
